<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>论坛-用户管理-后台管理系统</title>
		<link rel="stylesheet" href="${rc.contextPath}/bootstrap/css/bootstrap.css" />
		<link rel="stylesheet" href="${rc.contextPath}/zui/css/zui.css" />
		<script src="${rc.contextPath}/js/jquery.1.10.1.min.js"></script>
		<script type="text/javascript" src="${rc.contextPath}/zui/js/zui.js" ></script>
	</head>

	<body>
		<ul class="nav nav-tabs" id="adminTab">
			<li>
				<a href="index.html" data-togggle="tab">首页</a>
			</li>
			<li>
				<a href="${rc.contextPath}/admin/erterprise_manage" data-togggle="tab">企业管理及审核</a>
			</li>
			<li class="active">
				<a href="${rc.contextPath}/admin/forum_manage" data-togggle="tab">论坛管理</a>
			</li>
			<li>
				<a href="message.html" data-togggle="tab">消息</a>
			</li>
			<li class="pull-right">
				<a href="#" class="dropdown-toggle" data-toggle="dropdown">
					<img src="${rc.contextPath}/img/leader_default.png"  width="20px"/>管理员<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li>
						<a href="#">账号设置</a>
					</li>
					<li>
						<a href="#">退出</a>
					</li>
				</ul>
			</li>
		</ul>
		<!--  左侧菜单  -->
		<div style="margin-top: 20px;" class="col-xs-2">
			<nav class="menu" data-toggle="menu" style="width: 200px;">
				<ul class="nav nav-primary">

					<!-- <li class="active show nav-parent">
						<a href="javascript:;"><i class="icon icon-group"></i> 帖子</a>
						<ul class="nav">
							<li>
								<a href="${rc.contextPath}/admin/forum_manage"><i class="icon icon-plus"></i> 管理记录</a>
							</li>
						</ul>
					</li> -->

					<li class="active show nav-parent">
						<a href="javascript:;"><i class="icon icon-book"></i> 用户</a>
						<ul class="nav">
							<li class="active">
								<a href="${rc.contextPath}/admin/forum_manage"><i class="icon icon-list-ul"></i> 论坛用户管理</a>
							</li>
							<!-- <li>
								<a href="${rc.contextPath}/admin/userOpRecord"><i class="icon icon-pencil"></i> 用户操作记录</a>
							</li> -->
						</ul>
					</li>
				</ul>
			</nav>
		</div>

		<div class="col-xs-8" style="margin-top: 20px;">
			<div class="panel">
				<form action="${rc.contextPath}/admin/searchuser/1" method="get">
					<div class="panel-body">
						<div class="col-xs-2">
							<select name="searchtype" class="form-control">
								<option value="0" selected="selected">用户昵称</option>
								<!-- <option value="1">公司所在地</option> -->
							</select>
						</div>
						<div class="col-xs-6">
							<input type="text" class="form-control" name="keyword" />
						</div>
						<div class="col-xs-4">
							<input type="submit" class="btn btn-primary" value="搜索" />
						</div>
					</div>
				</form>
				<input type="hidden" value="$!keyword" id="searchctx"/>
			</div>

			<table class="table table-striped">
				<thead>
					<tr>
						<th width="40%">用户昵称</th>
						<th>绑定邮箱</th>
						<th>用户类型</th>
						<th>论坛权限管理</th>
					</tr>
				</thead>
				<tbody>
					#foreach($!user in $!userList)
					<tr>
						<td>$!user.nickname</td>
						<td>$!user.email</td>
						<td>
						#if($!user.usertype == 0)
						学生用户
						#end
						#if($!user.usertype == 1)
						企业用户
						#end
						</td>
						<td>
							<!-- <a href="#" class="" data-toggle="modal" data-target="#editCompany" data-id="$!user.id">禁言</a>&nbsp;|&nbsp;
							 -->
							#if($!user.roleId == 0)	
							<button type="button" class="btn btn-mini setmanager" data-id="$!user.id">设置为论坛管理员</button> &nbsp;|&nbsp;
							#else
							<button type="button" class="btn btn-mini cancelmanager" data-id="$!user.id">取消论坛管理员</button> &nbsp;|&nbsp;
							#end
						</td>
					</tr>
					#end
				</tbody>
			</table>

			<div class="pagination" style="margin: 0px 0 20px;">$!page.pageString</div>

		</div>

	</body>
	
	<script type="text/javascript">
	$(document)
	.on(
			"click",
			".setmanager",
			function(e) {
				jQuery.ajax({
					url	:	"${rc.contextPath}/admin/setForumManager?userId="+$(this).data("id"),
					type:	"get",
					dataType:"json",
					success:	function(data){
						(new jQuery.zui.ModalTrigger({
							custom : data.info
						})).show({hidden: function(){
							if(data.code == 200){
								location.reload();
								//window.location.href = "${rc.contextPath}/admin/addcompany";
							}
						}});
					}
				});
			});
	
	</script>

</html>